package com.ccnf.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ccnf.core.utils.ResultUtil;
import com.ccnf.model.entity.Expo;
import com.ccnf.model.mapper.ExpoMapper;
import com.ccnf.service.ExpoService;
import org.springframework.stereotype.Service;

@Service
public class ExpoServiceImpl extends ServiceImpl<ExpoMapper, Expo> implements ExpoService {
    @Override
    public Long saveExpo(Expo expo) {
        ResultUtil.validateSQL(baseMapper.insert(expo), "展会录入失败");
        return expo.getExpoId();
    }

    @Override
    public Expo findExpoByExpoId(Long expoId) {
        return baseMapper.selectById(expoId);
    }

    @Override
    public Expo findExpoByChanelCode(String channelCode) {
        Expo expo = new Expo();
        expo.setChannelCode(channelCode);
        return baseMapper.selectOne(expo);
    }
}